package ro.sergiu.configmanager.example;

import java.io.IOException;
import ro.sergiu.configmanager.ConfigContainer;

/**
 *
 * @author Toporjinschi
 */
public class CallExample {

    public static void main(String[] args) throws InstantiationException, IllegalAccessException, IOException {
        loadSettings();
        saveSettings();
    }

    private static void loadSettings() throws InstantiationException, IllegalAccessException, IOException {
        System.setProperty("prop-file", "d:/ss");
        ConfigContainer.loadConfigurations(SettingsExample.class);
        SettingsExample settings = ConfigContainer.getConfig(SettingsExample.class);
        System.out.println(settings);
    }

    private static void saveSettings() throws IOException {
        SettingsExample settings = ConfigContainer.getConfig(SettingsExample.class);
        settings.setPropBooleanFalse(true);
        settings.setPropBooleanTrue(false);
        settings.setPropInt(null);
        settings.setPropString("propSettings");
        settings.setPropStringPropName("propSettingsPropName");
        settings.setPropFloat(100.22f);
        settings.setPropDouble(102.99d);
        ConfigContainer.saveConfig(SettingsExample.class);
    }
}
